import { Schema } from "mongoose";

const chatMessageSchema = new Schema({
  // 发送者
  senderId: {
    type: Schema.Types.ObjectId,
    ref: "User",
    required: true,
  },
  // 接收者
  recipientId: {
    type: Schema.Types.ObjectId,
    ref: "User",
    required: true,
  },
  // 消息内容
  content: {
    type: String,
    required: true,
  },
  // 消息发送时间
  timestamp: {
    type: Date,
    default: Date.now,
  },
  read: {
    type: Boolean,
    default: false,
  },
});
export default chatMessageSchema;
